home *** CD-ROM | disk | FTP | other *** search
/ El Mac 9 / El Mac 9.iso / Shareware / Applications / Charting Coach v1.5 / Charting Coach v1.dxr / 00512.ls < prev    next >
Encoding:
Text File  |  1996-04-08  |  19.3 KB  |  648 lines

  1. on writecycleinfo
  2.   global beginDate, endDate, PeakDayNo, cylcleno, userNo, basis, currentCycleNo, previousPeak, bleedPeak, mucusNotPeak, relations, stamp, mucus, advice, comments, bioInfo
  3.   set writeFile to getSystemPath() & "FAF" & string(userNo) & "_" & string(currentCycleNo) & ".dat"
  4.   set writeUserFileObj to FileIO(mnew, "write", writeFile)
  5.   if objectp(writeUserFileObj) then
  6.     writeUserFileObj(mWriteString, bioInfo & RETURN)
  7.     writeUserFileObj(mWriteString, PeakDayNo & RETURN)
  8.     writeUserFileObj(mWriteString, previousPeak & RETURN)
  9.     writeUserFileObj(mWriteString, mucusNotPeak & RETURN)
  10.     writeUserFileObj(mWriteString, bleedPeak & RETURN)
  11.     writeUserFileObj(mWriteString, beginDate & RETURN)
  12.     writeUserFileObj(mWriteString, endDate & RETURN)
  13.     set x to count(stamp)
  14.     repeat with i = 1 to x
  15.       writeUserFileObj(mWriteString, getAt(relations, i) & RETURN)
  16.       writeUserFileObj(mWriteString, getAt(stamp, i) & RETURN)
  17.       writeUserFileObj(mWriteString, getAt(mucus, i) & RETURN)
  18.       writeUserFileObj(mWriteString, getAt(advice, i) & RETURN)
  19.       writeUserFileObj(mWriteString, getAt(basis, i) & RETURN)
  20.       set errX to writeUserFileObj(mWriteString, scramble(getAt(comments, i)) & RETURN)
  21.       if errX <> 0 then
  22.         reportWriteErr(errX)
  23.       end if
  24.     end repeat
  25.     writeUserFileObj(mdispose)
  26.   else
  27.     cursor(0)
  28.     alert("Writing to file failed.  Charting information may be lost.")
  29.   end if
  30. end
  31.  
  32. on reportWriteErr x
  33.   cursor(0)
  34.   if ((x > -39) and (x < -32)) or (x = -42) or (x = -43) or (x = -56) or (x = -65) or (x = -120) then
  35.     alert(the text of field ("error" && x))
  36.   else
  37.     alert("Error writing file.  Charting information may be lost.")
  38.   end if
  39. end
  40.  
  41. on readCycleInfo
  42.   global beginDate, endDate, cylcleno, userNo, basis, currentCycleNo, PeakDayNo, previousPeak, bleedPeak, mucusNotPeak, relations, stamp, mucus, advice, comments, bioInfo
  43.   set readFile to getSystemPath() & "FAF" & string(userNo) & "_" & string(currentCycleNo) & ".dat"
  44.   set bioInfo to []
  45.   set relations to []
  46.   set stamp to []
  47.   set mucus to []
  48.   set advice to []
  49.   set basis to []
  50.   set comments to []
  51.   set readUserFileObj to FileIO(mnew, "read", readFile)
  52.   if objectp(readUserFileObj) then
  53.     set bioInfo to makeAlist(readUserFileObj(mReadLine))
  54.     set PeakDayNo to integer(readUserFileObj(mReadLine))
  55.     set previousPeak to integer(readUserFileObj(mReadLine))
  56.     set bleedPeak to integer(readUserFileObj(mReadLine))
  57.     set mucusNotPeak to integer(readUserFileObj(mReadLine))
  58.     set beginDate to integer(readUserFileObj(mReadLine))
  59.     set endDate to integer(readUserFileObj(mReadLine))
  60.     repeat while objectp(readUserFileObj)
  61.       set nextline to readUserFileObj(mReadLine)
  62.       if nextline = EMPTY then
  63.         readUserFileObj(mdispose)
  64.         next repeat
  65.       end if
  66.       append(relations, integer(nextline))
  67.       append(stamp, integer(readUserFileObj(mReadLine)))
  68.       append(mucus, integer(readUserFileObj(mReadLine)))
  69.       append(advice, integer(readUserFileObj(mReadLine)))
  70.       append(basis, integer(readUserFileObj(mReadLine)))
  71.       append(comments, unscramble(readUserFileObj(mReadLine)))
  72.     end repeat
  73.   end if
  74.   if getSerialDate(theDate) < endDate then
  75.     alert("Illegal Dates Entered! This chart is invalid or the computer date is incorrect.")
  76.   end if
  77. end
  78.  
  79. on readShortCycleInfo currentCycle
  80.   global beginDate, endDate, userNo
  81.   set readFile to getSystemPath() & "FAF" & string(userNo) & "_" & string(currentCycle) & ".dat"
  82.   set readUserFileObj to FileIO(mnew, "read", readFile)
  83.   if objectp(readUserFileObj) then
  84.     set bioInfo to makeAlist(readUserFileObj(mReadLine))
  85.     set PeakDayNo to integer(readUserFileObj(mReadLine))
  86.     set previousPeak to integer(readUserFileObj(mReadLine))
  87.     set bleedPeak to integer(readUserFileObj(mReadLine))
  88.     set mucusNotPeak to integer(readUserFileObj(mReadLine))
  89.     set beginDate to integer(readUserFileObj(mReadLine))
  90.     set endDate to integer(readUserFileObj(mReadLine))
  91.     readUserFileObj(mdispose)
  92.   end if
  93. end
  94.  
  95. on readUserNames
  96.   global usrName, pswd, cycleNo, registered
  97.   set readFile to getSystemPath() & "Faf_Usr.dat"
  98.   set usrName to []
  99.   set pswd to []
  100.   set cycleNo to []
  101.   set readUserFileObj to FileIO(mnew, "read", readFile)
  102.   if objectp(readUserFileObj) then
  103.     set registered to unscramble(readUserFileObj(mReadLine))
  104.     set color to unscramble(readUserFileObj(mReadLine))
  105.     if color contains "color" then
  106.       set the hilite of member "color" to 1
  107.       set the hilite of member "b&w" to 0
  108.     else
  109.       set the hilite of member "b&w" to 1
  110.       set the hilite of member "color" to 0
  111.     end if
  112.   else
  113.     set the hilite of member "b&w" to 1
  114.     set the hilite of member "color" to 0
  115.     set registered to "XR"
  116.   end if
  117.   repeat while objectp(readUserFileObj)
  118.     set nextline to readUserFileObj(mReadLine)
  119.     if nextline = EMPTY then
  120.       readUserFileObj(mdispose)
  121.       next repeat
  122.     end if
  123.     append(usrName, unscramble(nextline))
  124.     append(pswd, unscramble(readUserFileObj(mReadLine)))
  125.     append(cycleNo, integer(readUserFileObj(mReadLine)))
  126.   end repeat
  127. end
  128.  
  129. on resetUserNames
  130.   global usrName, pswd, cycleNo, registered
  131.   set writeFile to getSystemPath() & "Faf_Usr.dat"
  132.   set writeUserFileObj to FileIO(mnew, "write", writeFile)
  133.   if objectp(writeUserFileObj) then
  134.     writeUserFileObj(mWriteString, scramble(registered) & RETURN)
  135.     if the hilite of member "color" then
  136.       writeUserFileObj(mWriteString, scramble("color") & RETURN)
  137.     else
  138.       writeUserFileObj(mWriteString, scramble("black") & RETURN)
  139.     end if
  140.     set x to count(cycleNo)
  141.     repeat with i = 1 to x
  142.       writeUserFileObj(mWriteString, scramble(getAt(usrName, i)) & RETURN)
  143.       writeUserFileObj(mWriteString, scramble(getAt(pswd, i)) & RETURN)
  144.       writeUserFileObj(mWriteString, getAt(cycleNo, i) & RETURN)
  145.     end repeat
  146.     writeUserFileObj(mdispose)
  147.   else
  148.     cursor(0)
  149.     alert("Writing to system folder failed!")
  150.   end if
  151. end
  152.  
  153. on scramble scrambleWord
  154.   set wordLength to the number of chars in scrambleWord
  155.   set scrambledNombre to EMPTY
  156.   repeat with i = 1 to wordLength
  157.     put char i of scrambleWord before scrambledNombre
  158.     put numToChar(random(70) + 48) before scrambledNombre
  159.     put numToChar(random(70) + 48) before scrambledNombre
  160.   end repeat
  161.   return scrambledNombre
  162. end
  163.  
  164. on unscramble scrambledWord
  165.   set wordLength to the number of chars in scrambledWord
  166.   set UnScrambledNombre to EMPTY
  167.   repeat with i = 1 to wordLength
  168.     set i to i + 2
  169.     put char i of scrambledWord before UnScrambledNombre
  170.   end repeat
  171.   return UnScrambledNombre
  172. end
  173.  
  174. on prepfrontpage
  175.   global stamp
  176.   if count(stamp) = 0 then
  177.     helpFrontPage()
  178.     go("frontpage")
  179.   else
  180.     writeLetter()
  181.     go("frontpage")
  182.     showDays()
  183.   end if
  184.   cursor(0)
  185. end
  186.  
  187. on writeLetter
  188.   global usrName, endDate, beginDate, cycleNo, userNo, theDate
  189.   put getAt(usrName, userNo) & "," into field "greeting"
  190.   put EMPTY into field "helpgreeting"
  191.   put "Day  " & differenceDate(beginDate, endDate) + 1 & ",   " & GetLongDate(endDate) into field "firstDate"
  192.   put "Day  " & differenceDate(beginDate, theDate) + 1 & ",   " & GetLongDate(theDate) into field "lastDate"
  193.   set newFactNo to random(50)
  194.   put the text of field ("fact" && newFactNo) into field "today fact"
  195. end
  196.  
  197. on helpFrontPage
  198.   global usrName, endDate, beginDate, userNo
  199.   put " " into field "firstDate"
  200.   put " " into field "lastDate"
  201.   put " " into field "today fact"
  202.   put getAt(usrName, userNo) & "," into field "greeting"
  203.   puppetSprite(9, 1)
  204.   set the visible of sprite 9 to 0
  205.   puppetSprite(9, 0)
  206.   put "Scientific evidence and statistical evaluation indicate that the information contained in this program is accurate.  However, we cannot guarantee a 100% effectiveness rate. For best results in the application of this method, we recommend the guidance of a certified teacher of the Family of the Americas.  You may call us at 1-800-443-3395 or (301)627-4351 or write FAF@IDSonline.com." into field "helpgreeting"
  207. end
  208.  
  209. on showMonthlyDays
  210.   global stamp, mucus, relations, firstMonthlyDay
  211.   puppetStatus(11, 48, 1)
  212.   puppetVisible(11, 48, 1)
  213.   set max to count(stamp)
  214.   if max > 50 then
  215.     set max to 50
  216.   end if
  217.   set min to max - 12 + 1
  218.   if min < 1 then
  219.     set min to 1
  220.   end if
  221.   set firstMonthlyDay to min
  222.   if max <= 12 then
  223.     set the castNum of sprite 11 to cast "no scroll"
  224.     set the locH of sprite 11 to 191
  225.     set the locV of sprite 11 to 150
  226.   else
  227.     set the castNum of sprite 11 to cast "nob"
  228.     positionNob()
  229.     set max to min + 11
  230.     if max > 50 then
  231.       set max to 50
  232.     end if
  233.   end if
  234.   if min > 39 then
  235.     set the castNum of sprite 12 to cast "cal 0"
  236.   else
  237.     set the castNum of sprite 12 to cast ("cal" && min)
  238.   end if
  239.   set x to 1
  240.   repeat with i = min to max
  241.     set the castNum of sprite (12 + x) to cast ("ministamp " & string(getAt(stamp, i)))
  242.     if getAt(mucus, i) <> 0 then
  243.       set the castNum of sprite (24 + x) to cast ("miniMucus " & string(getAt(mucus, i)))
  244.     else
  245.       set the visible of sprite (24 + x) to 0
  246.     end if
  247.     if i < max then
  248.       set the castNum of sprite (36 + x) to cast ("miniRel " & string(getAt(relations, i)))
  249.     else
  250.       set the visible of sprite (36 + x) to 0
  251.     end if
  252.     set x to x + 1
  253.     updateStage()
  254.   end repeat
  255.   repeat with i = max + 1 to 12
  256.     set the visible of sprite (12 + i) to 0
  257.     set the visible of sprite (24 + i) to 0
  258.     set the visible of sprite (36 + i) to 0
  259.   end repeat
  260.   cursor(0)
  261. end
  262.  
  263. on resetMonthlyDays
  264.   global stamp, mucus, relations, firstMonthlyDay
  265.   cursor(4)
  266.   go("monthly")
  267.   set min to firstMonthlyDay
  268.   set max to count(stamp)
  269.   if max > 50 then
  270.     set max to 50
  271.   end if
  272.   if max <= 12 then
  273.     set the castNum of sprite 11 to cast "no scroll"
  274.     set the locH of sprite 11 to 191
  275.     set the locV of sprite 11 to 150
  276.   else
  277.     set the castNum of sprite 11 to cast "nob"
  278.     positionNob()
  279.     set max to min + 11
  280.     if max > 50 then
  281.       set max to 50
  282.       set min to 39
  283.     end if
  284.   end if
  285.   if min > 39 then
  286.     set the castNum of sprite 12 to cast "cal 0"
  287.   else
  288.     set the castNum of sprite 12 to cast ("cal" && min)
  289.   end if
  290.   set x to 1
  291.   repeat with i = min to max
  292.     set the castNum of sprite (12 + x) to cast ("ministamp " & string(getAt(stamp, i)))
  293.     if getAt(mucus, i) <> 0 then
  294.       set the castNum of sprite (24 + x) to cast ("miniMucus " & string(getAt(mucus, i)))
  295.       set the visible of sprite (24 + x) to 1
  296.     else
  297.       set the visible of sprite (24 + x) to 0
  298.     end if
  299.     if i < count(stamp) then
  300.       set the castNum of sprite (36 + x) to cast ("miniRel " & string(getAt(relations, i)))
  301.       set the visible of sprite (36 + x) to 1
  302.     else
  303.       set the visible of sprite (36 + x) to 0
  304.     end if
  305.     set x to x + 1
  306.     updateStage()
  307.   end repeat
  308.   cursor(0)
  309. end
  310.  
  311. on showDays
  312.   global stamp, mucus
  313.   puppetStatus(23, 48, 1)
  314.   set max to count(stamp)
  315.   if max > 50 then
  316.     set max to 50
  317.   end if
  318.   set min to max - 12 + 1
  319.   if min < 1 then
  320.     set min to 1
  321.   end if
  322.   if min > 39 then
  323.     set the castNum of sprite 24 to cast "cal 0"
  324.   else
  325.     set the castNum of sprite 24 to cast ("cal" && min)
  326.   end if
  327.   set x to 1
  328.   repeat with i = min to max
  329.     if getAt(stamp, i) <> 0 then
  330.       set the castNum of sprite (24 + x) to cast ("ministamp " & string(getAt(stamp, i)))
  331.       set the visible of sprite (24 + x) to 1
  332.     else
  333.       set the visible of sprite (24 + x) to 0
  334.     end if
  335.     if getAt(mucus, i) <> 0 then
  336.       set the castNum of sprite (25 + x) to cast ("miniMucus " & string(getAt(mucus, i)))
  337.       set the visible of sprite (25 + x) to 1
  338.     else
  339.       set the visible of sprite (25 + x) to 0
  340.     end if
  341.     set x to x + 2
  342.     updateStage()
  343.   end repeat
  344. end
  345.  
  346. on hideDays
  347.   puppetVisible(23, 28, 1)
  348.   puppetStatus(23, 48, 0)
  349. end
  350.  
  351. on fillWgooseEggs
  352.   global relations, stamp, mucus, advice, basis, comments
  353.   append(relations, 0)
  354.   append(stamp, 0)
  355.   append(mucus, 0)
  356.   append(advice, 0)
  357.   append(basis, 0)
  358.   append(comments, " ")
  359. end
  360.  
  361. on NoDataThisDate
  362.   global endDate, theDate
  363.   fillWgooseEggs()
  364.   if endDate < getSerialDate(theDate) then
  365.     cursor(0)
  366.     go("date ok")
  367.   else
  368.     setupDayBook()
  369.   end if
  370. end
  371.  
  372. on chartAnEntry
  373.   global stamp, endDate, PeakDayNo, theDate, cycleNo, userNo, currentCycleNo
  374.   set currentCycleNo to getAt(cycleNo, userNo)
  375.   if count(stamp) = 0 then
  376.     leaveFrontPage()
  377.     go("firstDay")
  378.     cursor(0)
  379.   else
  380.     if endDate >= getSerialDate(theDate) then
  381.       cursor(0)
  382.       alert("You have already charted for today.  If you would like to change your entry, please use the daily calendar button.")
  383.     else
  384.       leaveFrontPage()
  385.       go("date ok")
  386.       cursor(0)
  387.     end if
  388.   end if
  389. end
  390.  
  391. on leaveFrontPage
  392.   puppetSprite(9, 1)
  393.   set the visible of sprite 9 to 1
  394.   puppetSprite(9, 0)
  395. end
  396.  
  397. on puppetStatus first, last, state
  398.   repeat with i = first to last
  399.     puppetSprite(i, state)
  400.   end repeat
  401. end
  402.  
  403. on puppetVisible first, last, state
  404.   repeat with i = first to last
  405.     set the visible of sprite i to state
  406.   end repeat
  407. end
  408.  
  409. on ask4date whichMonth
  410.   global newMonth, firstdayNo, numDaysInMonth, newday, newYear, theDate
  411.   cursor(4)
  412.   if (whichMonth = "previous") and (newMonth = value(item 1 of theDate)) then
  413.     set the visible of sprite 46 to 0
  414.     set the visible of sprite 47 to 1
  415.     set oldBox to newday + firstdayNo - 1
  416.     if (oldBox > 0) and (oldBox < 38) then
  417.       set the ink of sprite (oldBox + 8) to 36
  418.     end if
  419.     if newMonth > 1 then
  420.       set newMonth to newMonth - 1
  421.       set newYear to item 3 of theDate
  422.     else
  423.       set newMonth to 12
  424.       set newYear to getFullYear(item 3 of theDate) - 1
  425.       set newday to item 2 of theDate
  426.     end if
  427.   else
  428.     puppetStatus(1, 48, 0)
  429.     go("ask4date")
  430.     puppetVisible(1, 48, 1)
  431.     puppetStatus(9, 47, 1)
  432.     setDelimiter("/")
  433.     set the visible of sprite 47 to 0
  434.     set the visible of sprite 46 to 1
  435.     set newMonth to value(item 1 of theDate)
  436.     set newYear to item 3 of theDate
  437.     set newday to item 2 of theDate
  438.   end if
  439.   set serialdate to getSerialDate(string(newMonth & "/" & 1 & "/" & newYear))
  440.   set the text of member "month" to string(getMonth(serialdate))
  441.   if IsLeapYear(newYear) then
  442.     set numDays to [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
  443.   else
  444.     set numDays to [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
  445.   end if
  446.   set numDaysInMonth to getAt(numDays, newMonth)
  447.   setDelimiter()
  448.   set firstdayNo to serialdate mod 7
  449.   if firstdayNo = 0 then
  450.     set firstdayNo to 7
  451.   end if
  452.   set newBox to newday + firstdayNo - 1
  453.   if (newBox > 0) and (newBox < 38) then
  454.     set the ink of sprite (newBox + 8) to 2
  455.   end if
  456.   repeat with i = 29 to numDaysInMonth + firstdayNo
  457.     set the foreColor of sprite (i + 8) to 0
  458.   end repeat
  459.   repeat with i = numDaysInMonth + firstdayNo to 37
  460.     set the foreColor of sprite (i + 8) to 13
  461.   end repeat
  462.   set the castNum of sprite 7 to cast ("monthPos" && firstdayNo)
  463.   updateStage()
  464.   cursor(0)
  465. end
  466.  
  467. on makeCal numDaysInMonth, firstdayNo
  468.   repeat with i = 1 to 37
  469.     put " " into field string(i)
  470.   end repeat
  471.   repeat with i = 1 to numDaysInMonth
  472.     put i into field string(i + firstdayNo - 1)
  473.   end repeat
  474. end
  475.  
  476. on setUpBiodata
  477.   global bioInfo
  478.   set x to count(bioInfo)
  479.   repeat with i = 1 to x
  480.     set the hilite of member ("biodata " & getAt(bioInfo, i)) to 1
  481.   end repeat
  482.   go("biodata")
  483.   cursor(0)
  484. end
  485.  
  486. on giveadvice
  487.   resetAdvice()
  488.   writecycleinfo()
  489. end
  490.  
  491. on setupDayBook
  492.   giveadvice()
  493.   opendaybook()
  494. end
  495.  
  496. on opendaybook
  497.   global endDate, mucus, stamp, advice, comments, dayNo
  498.   put EMPTY into field "advice"
  499.   put EMPTY into field "comments"
  500.   put EMPTY into field "basis"
  501.   go("setup daily cal")
  502.   puppetSprite(6, 1)
  503.   set the visible of sprite 6 to 0
  504.   puppetSprite(6, 0)
  505.   repeat with i = 17 to 21
  506.     puppetSprite(i, 1)
  507.     set the visible of sprite i to 0
  508.     puppetSprite(i, 0)
  509.   end repeat
  510.   go("daily cal")
  511.   set dayNo to count(stamp)
  512.   repeat with i = 3 to 5
  513.     puppetSprite(i, 1)
  514.   end repeat
  515.   put dayNo into field "dayNo"
  516.   put getDayOfWeek(endDate) && getDate(endDate) into field "date"
  517.   set the castNum of sprite 3 to cast "stamp 0"
  518.   set the castNum of sprite 4 to cast ("mucus" && getAt(mucus, dayNo))
  519.   set the castNum of sprite 5 to cast ("stamp" && getAt(stamp, dayNo))
  520.   set the text of member "advice" to the text of member ("advice" && getAt(advice, dayNo))
  521.   set the text of member "basis" to the text of member ("basis" && getAt(basis, dayNo))
  522.   put getAt(comments, dayNo) into field "comments"
  523.   cursor(0)
  524. end
  525.  
  526. on leaveDayBook
  527.   global comments, dayNo
  528.   repeat with i = 17 to 21
  529.     puppetSprite(i, 0)
  530.     set the visible of sprite i to 1
  531.     puppetSprite(i, 0)
  532.   end repeat
  533.   puppetSprite(6, 1)
  534.   set the visible of sprite 6 to 1
  535.   puppetSprite(6, 0)
  536.   repeat with i = 3 to 5
  537.     puppetSprite(i, 0)
  538.   end repeat
  539.   if getAt(comments, dayNo) <> field "comments" then
  540.     setAt(comments, dayNo, field "comments")
  541.   end if
  542. end
  543.  
  544. on previousPage
  545.   global dayNo
  546.   if dayNo < 2 then
  547.     cursor(0)
  548.     alert("Can't go past the beginning of the cycle.")
  549.   else
  550.     resetPage(-1)
  551.   end if
  552. end
  553.  
  554. on nextPage
  555.   global stamp, dayNo, beginDate, theDate, cycleNo, userNo, currentCycleNo
  556.   if dayNo < count(stamp) then
  557.     resetPage(0)
  558.   else
  559.     if (beginDate + dayNo) > getSerialDate(theDate) then
  560.       cursor(0)
  561.       alert("Future calendar pages cannot be created.")
  562.     else
  563.       if getAt(cycleNo, userNo) <> currentCycleNo then
  564.         cursor(0)
  565.         alert("Cannot chart this cycle.  Only current cycles may be charted.")
  566.       else
  567.         KeepChartIn()
  568.       end if
  569.     end if
  570.   end if
  571. end
  572.  
  573. on resetPage direction
  574.   global endDate, beginDate, relations, mucus, stamp, advice, comments, dayNo
  575.   if getAt(comments, dayNo) <> field "comments" then
  576.     setAt(comments, dayNo, field "comments")
  577.   end if
  578.   if direction = 0 then
  579.     set dayNo to dayNo + 1
  580.   else
  581.     if direction = -1 then
  582.       set dayNo to dayNo - 1
  583.     else
  584.       set dayNo to direction
  585.     end if
  586.   end if
  587.   put dayNo into field "dayNo"
  588.   put getDayOfWeek(beginDate + dayNo - 1) && getDate(beginDate + dayNo - 1) into field "date"
  589.   if (beginDate + dayNo) > endDate then
  590.     set the castNum of sprite 3 to cast "stamp 0"
  591.   else
  592.     set the castNum of sprite 3 to cast ("relations" && getAt(relations, dayNo))
  593.   end if
  594.   set the castNum of sprite 4 to cast ("mucus" && getAt(mucus, dayNo))
  595.   set the castNum of sprite 5 to cast ("stamp" && getAt(stamp, dayNo))
  596.   set the text of member "advice" to the text of member ("advice" && getAt(advice, dayNo))
  597.   set the text of member "basis" to the text of member ("basis" && getAt(basis, dayNo))
  598.   put getAt(comments, dayNo) into field "comments"
  599.   updateStage()
  600.   cursor(0)
  601. end
  602.  
  603. on KeepChartIn
  604.   global endDate, askedToKeepChartin, theDate
  605.   if askedToKeepChartin = 1 then
  606.     leaveDayBook()
  607.     go("date ok")
  608.     cursor(0)
  609.   else
  610.     set askedToKeepChartin to 1
  611.     set x to getSerialDate(theDate) - endDate
  612.     if x = 1 then
  613.       set ending to "day."
  614.     else
  615.       set ending to x & " days."
  616.     end if
  617.     put "No data has been charted for the next " & ending & " Would you like to chart these days now." into field "date ok"
  618.     repeat with i = 17 to 21
  619.       puppetSprite(i, 1)
  620.       set the visible of sprite i to 1
  621.       puppetSprite(i, 0)
  622.     end repeat
  623.     cursor(0)
  624.   end if
  625. end
  626.  
  627. on InARow listToLook, searchDat, listLength
  628.   set x to 0
  629.   repeat with i = 1 to count(listToLook)
  630.     if getAt(listToLook, i) = searchDat then
  631.       set x to x + 1
  632.       if x >= listLength then
  633.         return 1
  634.       end if
  635.       next repeat
  636.     end if
  637.     set x to 0
  638.   end repeat
  639.   return 0
  640. end
  641.  
  642. on puppetEditable A, Z, state
  643.   puppetStatus(A, Z, 1)
  644.   repeat with i = A to Z
  645.     set the editableText of sprite i to state
  646.   end repeat
  647. end
  648.